import axios from 'axios'

export const OpenCompanySeriver = class OpenCompanySeriver{
    static openCompanySeriver = null
    requestUrl = 'http://localhost/opencompany'

    static getInstance() {
        if (this.openCompanySeriver == null) {
            this.openCompanySeriver = new OpenCompanySeriver()
        }
        return this.openCompanySeriver
    }
    //查询所有员工
    list(emp){
        return axios.get(`${this.requestUrl}/all`,{params:emp})
    }
    //id查有员工
    listById(id){
        return axios.get(`${this.requestUrl}/${id}`)
    }
    //添加员工
    save(emp){
        return axios.post(`${this.requestUrl}/`,emp)
    }
    //修改
    update(emp){
        return axios.put(`${this.requestUrl}/`,emp)
    }
    //删除
    remove(id){
        return axios.delete(`${this.requestUrl}/${id}`)
    }
}